Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>Click the button to display the port number of the current URL.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <p><b>Note:</b> If the port number is 80 (which is the default port number), some browsers will display 0 or nothing.</p> <script> function myFunction() { var x = "Port: " + location.port; document.getElementById("demo").innerHTML = x; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_loc_port by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:28:16 GMT --> </html>
Result:
Try it Yourself - © w3schools.com